import Set from '../index'
import Assert from '@/utils/assets'

export const test = () => {
    const set = new Set();
    const assert = new Assert()

    set.add(1)
    set.add(1)
    set.add(2)
    set.add(3)
    set.add(4)
    print(set)
    assert.type('contains').expect(set.contains(1)).toBe(true)
    set.remove(1)
    assert.type('contains').expect(set.contains(1)).toBe(false)
    print(set)
    set.remove(3)
    print(set)

}

/**
 * 打印
 * @param set 
 */
const print = (set: Set) => {
    let str = ''
    set.forEach((ele) => {
        str += ele + ' '
    })
    console.log(str)
}